home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
3006
/
3006.xpi
/
chrome
/
dwhelper.jar
/
content
/
add-to-blacklist.xul
< prev
next >
Wrap
Extensible Markup Language
|
2010-01-15
|
3KB
|
94 lines
<?xml version="1.0"?>
<!-- *****************************************************************************
* Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
****************************************************************************** -->
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
<dialog id="dwhelper-dump-media"
title="&pref.title.blacklist;"
flex="1"
onload="onLoad()"
ondialogaccept="return doOk()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
buttonlabelextra2="&label.add2bl.configure-blacklist;"
ondialogextra2="configureBlacklist();"
buttons="accept,cancel,extra2">
<html:style>
radiogroup {
margin-left: 15px;
}
</html:style>
<script><![CDATA[
var Util=Components.classes["@downloadhelper.net/util-service;1"]
.getService(Components.interfaces.dhIUtilService);
var simpleDomain=true;
var blDomain;
function onLoad() {
var entry=window.arguments[0];
var url=Util.getPropsString(entry,"media-url");
var domain=/\/\/([^\/]+)\//.exec(url)[1];
if(/^([^\.]\.)?[^\.]$/.test(domain)) { // simple domain
document.getElementById("simple-domain").setAttribute("value",
Util.getFText("add2bl.label.add-domain",[domain],1));
document.getElementById("simple-domain").setAttribute("hidden","false");
blDomain=domain;
} else {
var parts=domain.split(".");
for(var i=0;i<parts.length-1;i++) {
var radio=document.createElement("radio");
var subdomain=parts.slice(i,parts.length).join(".");
radio.setAttribute("label",subdomain);
radio.setAttribute("value",subdomain);
radio.setAttribute("id",subdomain);
if(i==0)
radio.setAttribute("selected","true");
document.getElementById("domains").appendChild(radio);
}
document.getElementById("domain-choice").setAttribute("hidden","false");
simpleDomain=false;
}
window.sizeToContent();
}
function doOk() {
if(!simpleDomain) {
blDomain=document.getElementById("domains").selectedItem.getAttribute("value");
}
var prefService=Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var pref=prefService.getBranch("dwhelper.");
var blPref=pref.getCharPref("media-host-blacklist");
var blacklist=blPref.split("|");
if(!(blDomain in blacklist)) {
blacklist.push(blDomain);
pref.setCharPref("media-host-blacklist",blacklist.join("|"));
}
return true;
}
function configureBlacklist() {
var options="chrome,centerscreen,toolbar,modal";
var data={ selectedPanel: "panel-capture", selectedTab: "blacklisttab" }
window.openDialog("chrome://dwhelper/content/preferences-new.xul",'',options, data );
}
]]>
</script>
<label id="simple-domain" hidden="true"/>
<vbox flex="1" id="domain-choice" hidden="true">
<label value="&add2bl.label.add-domain-choice;"/>
<radiogroup id="domains"/>
</vbox>
</dialog>